
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>微信支付</title>
<link rel="stylesheet" type="text/css" href="/themes/wnsc/Home/Pay/Css/pay_main.css">
<script src="/themes/wnsc/Home/Pay/js/jquery.js"></script>
<load href="/static/weipay/qrcode.js" />
<load href="/static/weipay/Base.js" />
<load href="/static/weipay/prototype.js" />
<load href="/static/weipay/mootools.js" />
<style type="text/css">
	#qrcode p{display: none;}
</style>
<style>
</style>
</head>
<body>
	<article class="ns-pay">
		<div class="order clearfix order-noQrcode">
			<!-- 订单信息 -->
			<div class="o-left">
				<h3 class="o-title">订单提交成功，请尽快付款！支付流水号：{$_GET['order_cn']}</h3>
				<p class="o-tips"></p>
			</div>
			<!-- 订单信息 end -->
			<!-- 订单金额 -->
			<div class="o-right">
				<div class="o-price">
					<em>应付金额</em><strong>{$count_price}</strong><em>元</em>
				</div>
			</div>
			<!-- 订单金额 end -->
			<div class="o-list j_orderList" id="listPayOrderInfo">
				<!-- 单笔订单 -->
				<!-- 多笔订单 end -->
			</div>
		</div>

		<div class="payment">
			<!-- 微信支付 -->
			<div class="pay-weixin">
				<div class="p-w-hd">微信支付</div>
				<div class="p-w-bd" style="position: relative">
					<div class="js-weixinInfo"
						style="position: absolute; top: -36px; left: 130px;">
						已等待<span id="timer">0</span>秒，过期后请刷新页面重新获取二维码。
					</div>
					<div class="p-w-box">
						<div class="pw-box-hd" id="qrcode"></div>
						<div class="pw-box-ft">
							<p style="font-size: 12px;">操作提示</p>
							<p id="myDiv"></p>
							
						</div>
					</div>
					<div class="p-w-sidebar"></div>
					<div ></div>
				</div>
			</div>
			<!-- 微信支付 end -->
		</div>

	</article>
	
	
		<script language="JavaScript">
     var myIntval=setInterval(function(){load()},1000);  
    function load(){  
       document.getElementById("timer").innerHTML=parseInt(document.getElementById("timer").innerHTML)+1; 
        var xmlhttp;    
        if (window.XMLHttpRequest){    
            // code for IE7+, Firefox, Chrome, Opera, Safari    
            xmlhttp=new XMLHttpRequest();    
        }else{    
            // code for IE6, IE5    
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");    
        }    
        xmlhttp.onreadystatechange=function(){    
            if (xmlhttp.readyState==4 && xmlhttp.status==200){    
                trade_state=xmlhttp.responseText; 
               if(trade_state=='SUCCESS'){  
                    document.getElementById("myDiv").innerHTML='支付成功';  
                    //alert(transaction_id);  
                    //延迟3000毫秒执行tz() 方法
                    clearInterval(myIntval);  
                    setTimeout("location.href='/user/order_success/order/{$_GET['order_cn']}.html'",2000);

                }else if(trade_state=='REFUND'){  
                    document.getElementById("myDiv").innerHTML='转入退款'; 
                    clearInterval(myIntval); 
                }else if(trade_state=='NOTPAY'){  
                    document.getElementById("myDiv").innerHTML='请扫码支付';  
                      // setTimeout("location.href='guoshi.html'",3000); 
                }else if(trade_state=='CLOSED'){  
                    document.getElementById("myDiv").innerHTML='已关闭';  
                    clearInterval(myIntval);
                }else if(trade_state=='REVOKED'){  
                    document.getElementById("myDiv").innerHTML='已撤销';  
                    clearInterval(myIntval);
                }else if(trade_state=='USERPAYING'){  
                    document.getElementById("myDiv").innerHTML='用户支付中';  
                }else if(trade_state=='PAYERROR'){  
                    document.getElementById("myDiv").innerHTML='支付失败'; 
                    clearInterval(myIntval); 
                }  
                 
            }    
        }    
        //orderquery.php 文件返回订单状态，通过订单状态确定支付状态  
        xmlhttp.open("POST","/pay/orderQuery",false);    
        //下面这句话必须有    
        //把标签/值对添加到要发送的头文件。    
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");    
        xmlhttp.send("out_trade_no={$out_trade_no}");
         
        }  
	</script>
	<script>
        if(<?php echo $unifiedOrderResult["code_url"] != NULL; ?>)
        {
            var url = "<?php echo $code_url;?>";
            //参数1表示图像大小，取值范围1-10；参数2表示质量，取值范围'L','M','Q','H'
            var qr = qrcode(10, 'H');
            qr.addData(url);
            qr.make();
            var wording=document.createElement('p');
            wording.innerHTML = "微信支付";
            var code=document.createElement('DIV');
            code.innerHTML = qr.createImgTag();
            var element=document.getElementById("qrcode");
            element.appendChild(wording);
            element.appendChild(code);
        }
    </script>

</body>
</html>
